<?php
include("connection.php");
include("header.php");

?>

<?php

$result1=mysql_query("SELECT * FROM event GROUP BY type ASC");
	while($row1 = mysql_fetch_array($result1))
	{
	$ev_type= $row1["type"];
	echo "<h2>".$ev_type."</h2>";
	$result=mysql_query("SELECT * FROM event WHERE type='".$ev_type."'");
	$total = mysql_num_rows($result);
	$i=0;
	 echo'<table width="500" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>EVENT NAME</td>
    <td>VENUE</td>
    <td>DATE</td>
    
    
  </tr>';


	while($i< $total)
	{
	$row=mysql_fetch_array($result);
	
	  $eventname = $row['eventname'];
	  $venue=$row["venue"];
	  $date=$row["date"];
	  //$type=$row["type"];
	
	
	echo"
	<tr>
	<td>".$eventname."</td>
	<td>".$venue."</td>
	<td>".$date."</td>
	<td><a href=printevent.php>moredetails</a></td>
	</tr>";
	
	$i++;
	}
	echo "</table>";
	}
	include("footer.php");


?>